<template>

    <el-aside width="200px">
        <h5 class="mb-2">代码生成配置</h5>
        <el-menu default-active="2" class="el-menu-vertical-demo" @open="handleOpen" @close="handleClose"
            unique-opened="true">
            <el-sub-menu index="1"  @click="tables">
                <template #title>
                    <span>用户基础信息</span>
                </template>
                <el-menu-item index="1-1" @click="changeTable">角色管理</el-menu-item>
                <el-menu-item index="1-2" @click="changeTable">用户管理</el-menu-item>
            </el-sub-menu>
            <el-sub-menu index="2" @click="tables">
                <template #title>
                    <span>日志管理</span>
                </template>
                <el-menu-item index="2-1" @click="changeTable">系统日志</el-menu-item>
            </el-sub-menu>
            <el-sub-menu index="3" @click="tables">
                <template #title>
                    <span>配置管理</span>
                </template>
                <el-menu-item index="3-1" @click="changeTable">字典数据</el-menu-item>
                <el-menu-item index="3-2" @click="changeTable">字典明细</el-menu-item>
            </el-sub-menu>
            <el-sub-menu index="4" @click="tables">
                <template #title>
                    <span>商品信息</span>
                </template>
                <el-menu-item index="4-1" @click="changeTable">商品分类</el-menu-item>
                <el-menu-item index="4-2" @click="changeTable">商品信息</el-menu-item>
            </el-sub-menu>
            <el-sub-menu index="5" @click="tables">
                <template #title>
                    <span>订单管理</span>
                </template>
                <el-menu-item index="5-1" @click="changeTable">订单管理</el-menu-item>
                <el-menu-item index="5-2" @click="changeTable">订单明细</el-menu-item>
                <el-menu-item index="5-3" @click="changeTable">订单详情</el-menu-item>
            </el-sub-menu>
            <el-sub-menu index="6" @click="tables">
                <template #title>
                    <span>客户管理</span>
                </template>
                <el-menu-item index="6-1" @click="changeTable">客户管理</el-menu-item>
                <el-menu-item index="6-2" @click="changeTable">省市县</el-menu-item>
            </el-sub-menu>
            <el-sub-menu index="7" @click="tables">
                <template #title>
                    <span>一对多</span>
                </template>
                <el-menu-item index="7-1" @click="changeTable">产品管理</el-menu-item>
                <el-menu-item index="7-2" @click="changeTable">产品颜色</el-menu-item>
                <el-menu-item index="7-3" @click="changeTable">产品尺寸</el-menu-item>
            </el-sub-menu>
            <el-sub-menu index="8" @click="tables">
                <template #title>
                    <span>审批流程</span>
                </template>
                <el-menu-item index="8-1" @click="changeTable">审批流程</el-menu-item>
                <el-menu-item index="8-2" @click="changeTable">审批节点</el-menu-item>
                <el-menu-item index="8-3" @click="changeTable">审批流程配置</el-menu-item>
                <el-menu-item index="8-3" @click="changeTable">审批流程配置</el-menu-item>
                <el-menu-item index="8-4" @click="changeTable">审批节点配置</el-menu-item>
            </el-sub-menu>
            <el-sub-menu index="1" @click="tables">
                <template #title>
                    <span>用户基础信息</span>
                </template>
                <el-menu-item index="9-1" @click="changeTable">角色管理</el-menu-item>
                <el-menu-item index="9-2" @click="changeTable">用户管理</el-menu-item>
            </el-sub-menu>
        </el-menu>
    </el-aside>

</template>

<script setup>
import { getCurrentInstance, ref } from 'vue';
import axios from 'axios';

let tableData = ref([])
let tableList = ref({})
let $this = getCurrentInstance();
let $bus = $this.appContext.config.globalProperties.$bus
let load = async () => {
    let { data } = await axios.get('https://www.vol.com/CodeGenerationLists/all')
    tableData.value = data
}
let table = async () => {
    let { data } = await axios.get('https://www.vol.com/CodeGenerationTable/all')
    tableList.value = data

}
defineExpose({ tableList })
const changeTable = async () => {
    await load()
    $bus.emit('tableDataList', tableData.value)
}

let emit = defineEmits(['sync-tl'])
const tables =async () => {
    await table()
    emit('sync-tl', tableList.value)
}


</script>

<style lang='scss' scoped>
.mb-2 {

    color: #2d8cf0;
    font-size: 13px;
    line-height: 39px;
    padding-left: 15px;
    border: 1px solid #abdcff;
    background-color: #f0faff;
    padding: 0 0 0 15px;

}
</style>